//ContainerDemo.java
package com.gitee.vincentzyu.qwq_forge189.inventory;

import com.gitee.vincentzyu.qwq_forge189.item.ItemLoader;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraftforge.items.ItemStackHandler;
import net.minecraftforge.items.SlotItemHandler;

public class ContainerDemo extends Container {

    private ItemStackHandler items = new ItemStackHandler(4);
    public EntityPlayer player;

    public ContainerDemo(EntityPlayer player){
        super();
        this.player = player;

        for (int i = 0; i < 4; ++i) {
            this.addSlotToContainer(new SlotItemHandler(items, i, 38 + i * 32, 20));
        }

        for (int i = 0; i < 3; ++i) {
            for (int j = 0; j < 9; ++j) {
                this.addSlotToContainer(new Slot(player.inventory, j + i * 9 + 9, 8 + j * 18, 51 + i * 18));
            }
        }

        for (int i = 0; i < 9; ++i) {
            this.addSlotToContainer(new Slot(player.inventory, i, 8 + i * 18, 105));
        }
    }

    @Override
    public boolean canInteractWith(EntityPlayer playerIn) {
        return new ItemStack(ItemLoader.qwqItem).isItemEqual(playerIn.getCurrentEquippedItem());
    }

    @Override public ItemStack transferStackInSlot(EntityPlayer playerIn, int index){
        return null;
    }


}
